<script type="text/javascript">
$(document).ready(function(){
	if ($('#side').height() < $(window).height() - 93) {
		$('#side').css("height", $(window).height() - 93);
	}

	$( window ).resize(function() {
		$('#side').css("height", $(window).height() - 93);
	});

	$('.titlebarSide_list').click(function() {
		if ($(this).hasClass('expand')) {
			$(this).removeClass('expand');
		} else {
			$(this).addClass('expand');
		}
		$(this).parent().find('ul').toggle(300);
	});
});
</script>
<?php echo $this->Form->create('Office')?>
<table cellpadding="0" cellspacing="0" border="0" id="contents">
    <tr> 
        <!-- SIDE -->
        <?php echo $this->element('side', array('isOffice' => true))?>
        <!-- /SIDE -->
        <td id="main">
            <div class="mainBox">
                <div class="titlebarMain_bg">
                    <h2 class="titlebarMain_icon">一覧</h2>
                </div>
                <div class="searchBox">
                    <?php echo $this->Form->input('group_id', array(
                        'options',
                        'empty' => 'グループ選択',
                        'id' => 'OfficeGroupId',
                        'label' => FALSE,
                        'div' => FALSE,
                    ))?>
                    <?php echo $this->Form->input('shop_id', array(
                        'options',
                        'empty' => '店舗選択',
                        'id' => 'OfficeShopId',
                        'label' => FALSE,
                        'div' => FALSE,
                    ))?>
                    
                    <?php echo $this->Form->submit('検索',array(
                        'class' => 'search_submit',
                        'id' => 'OfficeFilter',
                        'title' => '検索',
                        'label' => FALSE,
                        'div' => FALSE
                    )); ?>
                    <?php echo $this->Form->end()?>
                </div>
            </div><!-- /.mainBox -->
            <div id="mainTable">
                <table>
                    <thead>
                        <tr>
                            <th>店舗番号</th>
                            <th>グループ名</th>
                            <th>店舗名</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if (count($datas) > 0) :?>
                            <?php foreach ($datas as $shop):?>
                            <tr>
                                <td></td>
                                <td><?php echo $shop['ParentOffice']['name']?></td>
                                <td><?php echo $shop['Office']['name']?></td>
                                <td>
                                    <a class="btnTable_small" href="shop-detail.html">詳細</a>                                            
                                </td>
                            </tr>
                            <?php endforeach;?>
                        <?php endif;?>
                    </tbody>
                </table>
                <ul class="pagination flRight box25">
                <?php
                    echo $this->Paginator->prev('<< ' . __('previous'), array(
                        'class' => 'prev',
                        'tag' => 'li',
                        'disabledTag' => 'a'
                    ));
                ?>    
                    
                <?php     
                    echo $this->Paginator->numbers(array(
                        'separator' => '    ',
                        'tag' => 'li',
                        'currentClass' => 'active',
                        'currentTag' => 'a'
                    ));
                ?>
                <?php 
                    echo $this->Paginator->next(__('next') . '>>', array(
                        'class' => 'next',
                        'tag' => 'li',
                        'disabledTag' =>'a'
                    ));
                    
                ?>
                    
                </ul><!-- /.pagination -->
                
            </div>
        </td><!-- /#main -->
    </tr>
</table><!-- /#contents -->
